How can deadlocks be prevented
- Ensure 1 of 4 conditions cannot occur
- Negate each of the 4 conditions
- No single approach is appropriate (or possible) for all circumstances
- Removing the mutual exclusion condition means that no process may have exclusive access to a resource
- The "hold and wait" conditions may be removed by requiring processes to request all the resources they will need before starting up
- A "no preemption" (lockout) condition may also be difficult or impossible to avoid as a process has to be able to have a resource for a certain amount of time.
- The circular wait condition: Algorithms that avoid circular waits include "disable interrupts during critical sections" , and "use a hierarchy to determine a partial ordering of resources"